package com.easylinkin.sm.entity;

import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import site.morn.boot.data.entity.ReviserEntity;
import site.morn.constant.MetricUnit.Text;
import site.morn.data.Displayable;
import site.morn.data.Lockable;
import site.morn.validate.group.Add;

/**
 * 客户
 *
 * @author TianGanLin
 * @since 1.0.0, 2019/8/13
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@FieldNameConstants
@Table(name = "sm_customer")
@EqualsAndHashCode(callSuper = true)
public class Customer extends ReviserEntity implements Displayable, Lockable, Serializable {

  /**
   * @serialField
   */
  private static final long serialVersionUID = 1L;

  @ApiModelProperty("客户编号")
  @Id
  @GeneratedValue
  @Column(name="id_")
  private Long id;

  @ApiModelProperty("客户编码")
  @Column(name="customer_code_")
  private String customerCode;

  @ApiModelProperty("客户名称")
  @Column(length = Text.SHORT, name = "name_")
  @NotNull(groups = {Add.class})
  private String name;

  @ApiModelProperty("联系方式")
  @Column(length = Text.SHORT, name = "phone_number_")
  @NotNull(groups = {Add.class})
  private String phoneNumber;

  @ApiModelProperty("客户邮箱")
  @Column(length = Text.SHORT , name = "email_")
  @NotNull(groups = {Add.class})
  private String email;

  @ApiModelProperty("客户地址")
  @Column(length = Text.NORMAL, name = "address_")
  private String address;

  @ApiModelProperty("备注")
  @Column(length = Text.NORMAL, name = "remark_")
  private String remark;

  @ApiModelProperty("企业Logo")
  @Column(length = Text.SHORT, name = "logo_")
  private String logo;

  @ApiModelProperty("显示状态")
  @Column(name = "display_")
  private Boolean display;

  @ApiModelProperty("锁定状态")
  @Column(name = "locked_")
  private Boolean locked;
}
